﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

namespace GameLib {
    class Game : IGame {
        public IModList activeMods = new ModList();
        public IModList installedMods = new ModList();

        public IModConflictHandler conflictHandler;
        public IModDependencyHandler dependencyHandler;
        public IModMessageHandler messageHandler;

        public string Id {
            get;
            set;
        }

        public string Title {
            get;
            set;
        }

        public string GameDir {
            get;
            set;
        }

        public string BinDir {
            get;
            set;
        }

        public string DataDir {
            get;
            set;
        }

        public string Exe {
            get;
            set;
        }

        public string ConfigFile {
            get;
            set;
        }

        public IGame Clone() {
            BinaryFormatter bf = new BinaryFormatter();
            MemoryStream ms = new MemoryStream();
            bf.Serialize(ms, this);
            ms.Flush();
            ms.Position = 0;
            return (IGame) bf.Deserialize(ms);
        }

        public IModList getActiveMods() {
            return activeMods;
        }

        public IModList getInstalledMods() {
            return installedMods;
        }

        public void setActiveMods(ModList active) {
            activeMods = active;
        }

        public void setInstalledMods(ModList installed) {
            installedMods = installed;
        }
    }
}
